package org.apache.struts.helloworld.action;

import org.apache.struts.helloworld.model.AuthData;

import com.opensymphony.xwork2.ActionSupport;

public class Authorize extends ActionSupport {	
	private String userName;
	private String message;
	private String userPass;
	
	private static final long serialVersionUID = 1L;
	
	public Authorize()  {
		
	}

	public String execute() {
	       setMessage(getUserName());
	       
	       //if ((getUserName().equals("admin")) && (getUserPass().equals("hbxfhl")))
	       if ((getUserName().equals(AuthData.USERNAME)) && (getUserPass().equals(AuthData.USERPASS)))
	       	return "SUCCESS";
	       else
	   		return "ERROR";
	}
	
    public String getMessage() {
        return message;
    }
 
    public void setMessage(String message) {
        this.message = message;
    }
 
    public String getUserName() {
        return userName;
    }
 
    public void setUserName(String userName) {
        this.userName = userName;
    }
    
    public String getUserPass() {
        return userPass;
    }
 
    public void setUserPass(String userPass) {
        this.userPass = userPass;
    }
}
